    <body>
        <div class="x-body">
            <form class="layui-form layui-form-pane">
                <div class="layui-form-item">
                    <label for="L_title" class="layui-form-label">
                        标题
                    </label>
                    <div class="layui-input-block">
                        <input type="text" id="L_title" name="title" required lay-verify="title" value="<?php echo $question['title'] ?>" 
                        autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item layui-form-text">
                    <div class="layui-input-block">
                        <textarea id="L_content" name="content" placeholder="请输入内容" class="layui-textarea fly-editor" style="height: 260px;"><?php echo htmlspecialchars_decode($question['content']) ?></textarea>
                    </div>
                    <label for="L_content" class="layui-form-label" style="top: -2px;">
                        描述
                    </label>
                </div>
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">
                            所在类别
                        </label>
                        <div class="layui-input-block">
                            <select lay-verify="required" name="cid">
                                <option></option>
                                    <?php foreach ($cate as $top) { ?>
                                    <optgroup label="<?php echo $top['cname'] ?>">
                                        <?php foreach ($top['son'] as $v) { ?>
                                            <option value="<?php echo $v['id'] ?>" <?php if ($v['id']==$question['cid']) {
                                               echo 'selected';
                                            } ?> > <?php echo $v['cname'] ?></option>
                                        <?php } ?>                                            
                                    </optgroup>
                                    <?php } ?>
                            </select>
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <input type="hidden" name="qid" value="<?php echo $question['id'] ?>" >
                    <button class="layui-btn"  lay-filter="add" lay-submit>保存</button>
                </div>
            </form>
        </div>
        <script>
            layui.use(['form','layer','layedit'], function(){
                $ = layui.jquery;
              var form = layui.form()
              ,layer = layui.layer
              ,layedit = layui.layedit;


            layedit.set({
              uploadImage: {
                url: '{:U('home/wen/uploadpic')}' //接口url
                ,type: '' //默认post
              }
            });
  
            //创建一个编辑器
            editIndex = layedit.build('L_content');

              //监听提交
              form.on('submit(add)', function(data){
                //发异步，把数据提交给php
                $.ajax({
                    url: '{:U('admin/question/editsave')}',
                    type: 'POST',
                    dataType: 'json',
                    data: data.field,
                })
                .done(function(respones) {
                    if (respones.error==0) {
                        layer.alert("保存成功", {icon: 6},function () {
                            // 获得frame索引
                            var index = parent.layer.getFrameIndex(window.name);
                            //关闭当前frame
                            parent.layer.close(index);
                        })
                    }else{
                        layer.msg(respones.info);
                    };
                })
                .fail(function() {
                    console.log("error");
                })
                return false;
              });
              
              
            });
        </script>
    </body>

</html>